<template>
	<view class="container" :loading="loading">
		<uni-section title="基本用法" type="line">
			<view class="form">
				<!-- 基础用法，不包含校验规则 -->
				<uni-forms ref="form" :modelValue="form">
					<uni-forms-item label="申请人用户名" required>
						<uni-easyinput v-model="form.username" placeholder="请输入申请人用户名" />
					</uni-forms-item>
					<uni-forms-item label="请假时长" required>
						<uni-easyinput v-model="form.duration" placeholder="请输入请假时长，单位：天" />
					</uni-forms-item>
					<uni-forms-item label="工作委托人" required>
						<uni-easyinput v-model="form.principal" placeholder="请输入工作委托人" />
					</uni-forms-item>
					<uni-forms-item label="联系电话" required>
						<uni-easyinput v-model="form.contactPhone" placeholder="请输入联系电话" />
					</uni-forms-item>
					<uni-forms-item label="标题" required>
						<uni-easyinput v-model="form.title" placeholder="请输入标题" />
					</uni-forms-item>
					<uni-forms-item label="请假开始时间">
						<uni-datetime-picker type="datetime" return-type="timestamp" v-model="form.startDate"/>
					</uni-forms-item>
					<uni-forms-item label="请假结束时间">
						<uni-datetime-picker type="datetime" return-type="timestamp" v-model="form.endDate"/>
					</uni-forms-item>
				</uni-forms>
				<view class="button-group">
					<button type="primary" @click="submit()">提交</button>
				</view>
			</view>
		</uni-section>
	</view>
</template>

<script>
	import taskApi from "@/api/workflow/task.js";
	import { getLeave } from "@/api/demo/leave";
	export default {
		data() {
			return {
				// 加载中
				loading: true,
				// 列表数据
				list: [],
				// 总条数
				total: 0,
				// 表单参数
				form: {},
			}
		},
		created () {
			this.getById();
		},
		methods: {
			// 查询
			getById () {
				this.loading =true
				getLeave(this.$route.query.businessKey).then(res => {
					this.form = res.data
					this.loading =false
				})
			},
			submit(){
				
			}
		}
	}
</script>

<style lang="scss">

	.container {
		height: calc(100vh - 44px);
	}
	.form{
		padding: 15px;
		border-radius: 6px;
	    height: calc(100vh - 44px);
	}
</style>

